//
//    Copyright (C) 2012  OinkStudio
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package game;

public class SkillTwins extends Skill {

	public SkillTwins(String name) {
		super(name);
		// TODO Auto-generated constructor stub
	}

	Skill twin;

	@Override
	public void check(Skill nextSkill, Game game, int row, int column) {
		// this=nextSkill.clone();
		// twin = nextSkill.clone();
		Obolo[][] board = game.getBoard();

		if (board[game.getLastRow()][game.getLastColumn()].getSouth() instanceof SkillTwins) {
			board[game.getLastRow()][game.getLastColumn()].setSouth(nextSkill);
		}
		if (board[game.getLastRow()][game.getLastColumn()].getEast() instanceof SkillTwins) {
			board[game.getLastRow()][game.getLastColumn()].setEast(nextSkill);
		}
		if (board[game.getLastRow()][game.getLastColumn()].getNorth() instanceof SkillTwins) {
			board[game.getLastRow()][game.getLastColumn()].setNorth(nextSkill);
		}
		if (board[game.getLastRow()][game.getLastColumn()].getWest() instanceof SkillTwins) {
			board[game.getLastRow()][game.getLastColumn()].setWest(nextSkill);
		}
		if (board[row][column].getSouth() instanceof SkillTwins) {
			board[row][column].setSouth(board[game.getLastRow()][game
					.getLastColumn()].getNorth());
		}
		if (board[row][column].getNorth() instanceof SkillTwins) {
			board[row][column].setNorth(board[game.getLastRow()][game
					.getLastColumn()].getSouth());
		}
		if (board[row][column].getEast() instanceof SkillTwins) {
			board[row][column].setEast(board[game.getLastRow()][game
					.getLastColumn()].getWest());
		}
		if (board[row][column].getWest() instanceof SkillTwins) {
			board[row][column].setWest(board[game.getLastRow()][game
					.getLastColumn()].getEast());
		}
	}

	public boolean beEquals(Skill skill) {
		if (skill instanceof SkillTwins)
			return true;
		return false;
	}
	/*
	 * @Override public int hashCode(){ return 2; }
	 */

}
